import redis
import logging

class AppBaseConfig():
    DEBUG = True
    SECRET_KEY = '8a3145e1-dd7c-49d1-89eb-4657ad5d365d'

    # mysql数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:1234@localhost:3366/flask_'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_ECHO = False

    # redis连接配置
    REDIS_HOST = 'localhost'
    REDIS_PORT = 6379
    REDIS_PWD = ''

    # SESSION配置
    SESSION_TYPE = 'redis'
    SESSION_USE_SINGER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT,password=REDIS_PWD)
    PERMANENT_SESSION_LIFETIME = 3600 * 24 #SESSION生命周期

    # logging的级别
    LOGGING_LEVEL = logging.DEBUG

class AppDevelopConfig(AppBaseConfig):
    pass

class AppProductConfig(AppBaseConfig):
    DEBUG = False

class AppTestConfig(AppBaseConfig):
    pass

app_config_dice = dict(
    develop = AppDevelopConfig,
    product = AppProductConfig,
    test = AppTestConfig,
)
if __name__ == '__main__':
    pass